package edu.auctionmart

import grails.converters.JSON

class WebServiceController {

    def index() { }
	
	
	def listJson = {
		
		if (params.status) {
			if (params.status == "ongoing") {
				def auctionList = Auction.findAll ("from edu.auctionmart.Auction as a where a.status=?", [AuctionStatus.OnGoing])
				render auctionList as JSON
			} else if (params.status == "closed") {
			def auctionList = Auction.findAll ("from edu.auctionmart.Auction as a where a.status=?", [AuctionStatus.Closed])
			render auctionList as JSON
			}
		} else {
			def auctionList = Auction.findAll()
			render auctionList as JSON
		}
		
}

}